package controller.admin;
import com.jfinal.aop.Inject;
import com.jfinal.kit.Ret;

import controller.admin.base.BaseAdminController;
import enums.DaliyItemsType;
import model.DaliyItems;
import service.DaliyItemsService;

public class AdminDaliyItemsController extends BaseAdminController {
	@Inject DaliyItemsService daliyItemsService ;

	public void list() {
	    renderJson("list" , daliyItemsService.getList());
	}

	public void info() {
		Long id = getParaToLong("id");
        set("data", DaliyItems.dao.findById(id) );
        set("typeList", DaliyItemsType.toList());
        renderJson();
	}

	public void save() {
		DaliyItems daliyItems = getModel(DaliyItems.class , "x");
        Ret ret = daliyItemsService.save(daliyItems);
        renderJson(ret);
	}

	public void delete() {
        Long id = getParaToLong("id");
        Ret ret = daliyItemsService.delete(id);
        renderJson(ret);
    }
}
